package com.itheima.patterns.builderpattern.singleton.lazyman1;

public class Singleton{
    
    //私有构造方法
    private Singleton(){}
    
    //声明Singleton类型的变量instance，并未进行赋值
    private static Singleton instance;
    
    //使用关键字synchronized的目的在于保证线程安全
    public static synchronized Singleton getInstance(){
        if(instance == null){
            instance = new Singleton();
        }
        return instance;
    }
}